package site.jlopen.components.enums;

public enum GrapGroupNameEnum {
	DATA_PREP("data_prep", "数据准备"), 
	DATA_FILTER("data_filter", "数据过滤"), 
	PREPROCESSING("preprocessing", "预处理"), 
	FEATURE("feature", "特征工程"), 
	STATS("stats", "统计"), 
	MLTRAIN("ml.train", "模型训练"), 
	MLPREDICT("ml.predict", "模型预测"), 
	MLEVAL("ml.eval", "模型评估"), 
	IO("io", "IO系列"), 
	MODEL("model", "模型")
	
	;
	private final String code;

	private final String title;

	GrapGroupNameEnum(String code, String title) {
		this.code = code;
		this.title = title;
	}

	public String getCode() {
		return code;
	}

	public static String parse(String code) {
		for (GrapGroupNameEnum value : GrapGroupNameEnum.values()) {
			if (value.code.equals(code)) {
				return value.name();
			}
		}
		return null;
	}

	public GrapGroupNameEnum value(String code) {
		for (GrapGroupNameEnum value : GrapGroupNameEnum.values()) {
			if (value.code.equals(code)) {
				return value;
			}
		}
		return null;
	}

	public String title(GrapGroupNameEnum value) {
		return value.title;
	}

	public static String title(String code) {
		for (GrapGroupNameEnum value : GrapGroupNameEnum.values()) {
			if (value.code.equals(code)) {
				return value.title;
			}
		}
		return null;
	}

}
